home *** CD-ROM | disk | FTP | other *** search
- PAGE ,132
- TITLE For use with M2S.LIB
-
-
- DOSSEG
- .MODEL SMALL
- .286
-
-
- .STACK
-
- .DATA?
- WorkArea db 500 dup(?) ; working string area
-
-
- .XLIST
- .DATA
- Str1 db "This is the first string to test for length.",0
- Str2a db "This is part A of string 2 for ",0
- Str2b db "an append to this, part B of string 2.",0
- Str3a db "This string is part A of the ",0
- Str3b db "concatination process used in this, part B, for testing.",0
- Str4 db "The word EXTRACTED will be taken from this sentence.",0
- Str5 db "This sentence is splitFrom here to eternity.",0
- Str6 db "ThIS wILl CHANGE aLl LeTterS TO LOWERCASE.",0
- Str7 db "we Want all ThESE letter to upperCase.",0
- Str8 db "tHIS Sure aS hELL bETTER be proper when it is done.",0
- Str9 db " This is to make sure it is, well , trimmed.",0
- .LIST
-
-
-
- .CODE
- ASSUME DS:DGROUP,ES:DGROUP,SS:STACK
-
-
- Main PROC
-
- EXTRN Length:NEAR, Append:NEAR, Concat:NEAR, Extract:NEAR
- EXTRN Split:NEAR, LowerCase:NEAR, UpperCase:NEAR
- EXTRN Proper:NEAR, Trim:NEAR
-
-
- Mov Ax,DGROUP
- Mov Ds,Ax ; Get this address
- Mov Es,Ax ; And this
- Call ClearWORK ; Clear the work Area
-
- ;---- Test of Length
- Lea Si,Str1 ; Get the address of string 1
- Call Length ; See if the length works
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test of Append
- Lea Si,Str2a ; Get part A
- Lea Di,WorkArea ; Get the address of the work area
- Call Length ; Get the length of that first part
- Inc Ax ;
- Mov Cx,Ax ;
- Rep Movsb ; Copy
- Lea Si,WorkArea ; We needed to displace the string
- Lea Di,Str2b ; Address of part b
- Call Append ; Append into the work area
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test of Concat ;
- Lea Si,Str3a ; Get the address of part A
- Lea Bx,Str3b ; Part B
- Lea Di,WorkArea ;
- Call Concat ; Concatenate
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test if Extract ;
- Lea Si,Str4 ; Get the string address
- Lea Di,WorkArea ; This
- Mov Ax,9 ; Offset is 9 of the word
- Call Extract ;
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test of Split
- Lea Si,Str5 ; String to split
- Lea Di,WorkArea ; area to put second half of string
- Mov Bx,22 ; Split at 22
- Call Split ;
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test of LowerCase
- Lea Si,Str6 ;
- Lea Di,WorkArea ;
- Call LowerCase ;
- Call ClearWORK ; Clear the work Area
- ;
- ;--- Test of UpperCase
- Lea Si,Str7 ;
- Lea Di,WorkArea ;
- Call UpperCase ;
- Call ClearWORK ;
- ;
- ;--- Test of Proper ;
- Lea Si,Str8 ;
- Lea Di,WorkArea ;
- Call Proper ;
- Call ClearWORK ;
- ;
- ;--- Test of Trim ;
- Lea Si,Str9 ;
- Lea Di,WorkArea ;
- Call Trim ;
- Call ClearWORK ;
-
- Mov AX,4C00h ; exit
- Int 21h ; Out
- Main Endp
-
-
-
-
- ClearWORK PROC
- ;----------- Clears the string work area -------------------------------------;
- Lea Di,WorkArea
- Mov Al,0
- Mov Cx,500
- Cld
- Rep Stosb
- Ret
- ClearWORK Endp
-
-
-
-
- END Main
-